//
//  UIImage+Extension.swift
//  SinaWeibo
//
//  Created by Apple on 16/5/10.
//  Copyright © 2016年 devshaw. All rights reserved.
//

import UIKit


extension UIImage{

 // MARK: - 屏幕截图的方法
    class func getScreenShot()-> UIImage {
        //获取 window
        let window = UIApplication.sharedApplication().keyWindow
        //开启绘图 size 大小
        UIGraphicsBeginImageContextWithOptions(kUIScreenBounds.size, false, 1)
        //让 window进行绘图
        window?.drawViewHierarchyInRect(kUIScreenBounds, afterScreenUpdates: false)
        //获取 image
        let image = UIGraphicsGetImageFromCurrentImageContext()
        //关闭绘画

        UIGraphicsEndImageContext()

        return image
    }
}
